<%--
  Created by IntelliJ IDEA.
  User: jshand
  Date: 2022-10-21
  Time: 10:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<h3>设置Cookie的</h3>

<%

    Cookie cookie = new Cookie("idno1","0000002");
    cookie.setMaxAge(10);  //最大存活时间  秒    默认值 -1 ： 会话有效  ， 设置为0 删除Cookie
    // cookie.setDomain("127.0.0.1");
    // cookie.setHttpOnly(true);
    // cookie.setSecure(true);
    cookie.setPath(request.getContextPath());



    Cookie cookie2 = new Cookie("idno2","0000002");
    cookie2.setMaxAge(10);  //最大存活时间  秒    默认值 -1 ： 会话有效  ， 设置为0 删除Cookie
    // cookie.setDomain("127.0.0.1");
    cookie2.setHttpOnly(true);   //只能被浏览器访问，  js代码不可以访问

    cookie2.setSecure(true);     //   https: 协议  http+ SSL
    cookie2.setPath(request.getContextPath());

    response.addCookie(cookie);
    response.addCookie(cookie2);


%>


</body>
</html>
